import Taro, { Component } from '@tarojs/taro'
import {View, Button, Text, Input, Icon, ScrollView} from '@tarojs/components'
import './GoldPage.scss'
import { AtNoticebar } from 'taro-ui'
import {getfirts_order} from '../../mode/firstOrder'
import taroUtils from "../../utils/taroUtils";
import Recommend from "../../components/recommend/recommend";
import {NumToPx} from "../../utils/utils";
import {getTaoBaoData} from "../../mode/homeCtr";
import appStore from "../../store/appStore";
class GoldPage extends Component{

  config = {
    navigationBarTitleText: '礼金商品'
  }

  constructor() {
    super();
    this.state={
        Notice:"",
        auth:"",
        data:[]
    }
  }

  componentWillUnmount () {

  }

  componentDidMount() {

  }
  componentDidShow () {
    getTaoBaoData().then(res=>{
      this.setState({
        Notice:res.Notice,
        auth:res.auth,
        data:res.data,
      })
    })
  }

  render () {
    var h = 750//this.state.searchScrollviewHeight
    return (
      <View className={'home'}>
        {
          appStore.appConfig.open >=1?(
            <View>
              <AtNoticebar  speed={30} single marquee icon='volume-plus'>
                {this.state.Notice}
              </AtNoticebar>
              <AtNoticebar  >
                福利礼金卷有限～～～～
              </AtNoticebar>
            </View>
          ):(<View></View>)
        }


        <View className={'sroView'}>
          {
            this.state.data.length <=0 ?(<View>
              <Text className={'text1'}>
                暂无福利商品,正在努力筛选中...\n
              </Text>

              <Text className={'text1'}>
                {
                  appStore.appConfig.open >=1 ?  this.state.auth:""
                }

              </Text>

            </View>):(
              <View>

                <Text>
                  {
                    appStore.appConfig.open >=1 ?  this.state.auth:""
                  }
                </Text>
                <Recommend   list={this.state.data} height={NumToPx(750)} ToLowerEvent={(t)=>{

                }} />
              </View>

            )
          }
        </View>
      </View>
    )
  }
}

export  default GoldPage
